Dfns workspace: Difference between revisions

Jump to navigation Jump to search
91 bytes added ,  09:28, 25 August 2020
m
no edit summary
(+example usage)
mNo edit summary
(One intermediate revision by the same user not shown)
Line 1: Line 1:
'''dfns.dws''' is a workspace which is supplied together with [[Dyalog APL]]. It's is a collection of examples of programming in [[dfn|direct functions]], which were written by multiple people since 1990s.
'''dfns.dws''' is a [[workspace]] which is supplied together with [[Dyalog APL]]. It's is a collection of examples of programming in [[dfn|direct functions]], which were written by multiple people since 1990s.


Late [[John Scholes]] was the editor of this workspace. He presented a talk about the contents of the workspace at [[Dyalog user meeting|Dyalog '09]].<ref>[[Dyalog user meeting|Dyalog '09]] C03: Introduction to D-Functions (dfns) ([https://dyalog.tv/Dyalog09/?v=OZARVrGQQho Video 1 (124 mins)], [https://dyalog.tv/Dyalog09/?v=RQNSe9s_3eE Video 2 (67 mins)])</ref>
Late [[John Scholes]] was the editor of this workspace. He presented a talk about the contents of the workspace at [[Dyalog user meeting|Dyalog '09]].<ref>[[Dyalog user meeting|Dyalog '09]] C03: Introduction to D-Functions (dfns) ([https://dyalog.tv/Dyalog09/?v=OZARVrGQQho Video 1 (124 mins)], [https://dyalog.tv/Dyalog09/?v=RQNSe9s_3eE Video 2 (67 mins)])</ref>


== Example usage ==
== Example usage ==
As with other workspaces, workspace <source lang=text inline>dfns</source> can be copied into the current workspace using [[system command]] <source lang=apl inline>)copy</source>:
As with other workspaces, workspace <source lang=text inline>dfns</source> can be copied into the current workspace using the [[Quad name|system function]] <source lang=apl inline>⎕CY</source>:
<source lang=apl>
<source lang=apl>
       )copy dfns
       ⎕CY'dfns'


       ⍝ Example call: timing an expression using function `cmpx`
       ⍝ Example call: timing an expression using function `cmpx`
Line 12: Line 12:
0.0001302490234375
0.0001302490234375
</source>
</source>
Copying in only one or more specific functions is done by adding a left [[argument]]:
<source lang=apl>
      'dec' 'hex'⎕CY'dfns'


Alternatively, the workspace can be copied using [[Quad name|system function]] <source lang=apl inline>⎕CY</source> (copy workspace):
      hex 1234
04d2
      dec '04d2'
1234
</source>
It can also be used to import the entire workspace into a utility [[namespace]]:
<source lang=apl>
<source lang=apl>
      ⍝ Copy dfns workspace into a namespace called `dfns`
       {(⍎⍵⎕NS⍬).⎕CY ⍵}'dfns'
       {(⍎⍵⎕NS⍬).⎕CY ⍵}'dfns'


Navigation menu