Quick actions

cmd+k|ctrl+k

Navigation

Languages

Untitled

Snippet info

Language

Nim

Visibility

unlisted

Author

legacy-anonymous

Created

2017-04-05T22:28:12Z

Updated

2017-04-05T22:28:12Z


type # ports
  PortKind = enum
    Bool, Int, Float, String
  PortType = concept c
    (c is bool or
     c is int or
     c is float or
     c is string)
  NumericPort = concept c
    c is PortType
    c is int or c is float

type # parameters
  Parameter[T: PortType] = object
    name: string
    value: T
    when T is NumericPort:
      minVal, maxVal: T


var p = Parameter[float](name:"freq", value:440.0, minVal:0.0, maxVal:20000.0)
echo repr p
INFO